﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace EasyTest {

    /// <summary>
    /// 
    /// </summary>
    public class DynamicElement {

        /// <summary>
        /// 
        /// </summary>
        private string FindByWithParameter { get; set; }

        /// <summary>
        /// 
        /// </summary>
        private Focus Focus { get; set; }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="findByWithParameter"></param>
        /// <param name="focus">Document container with controls to search for.</param>
        public DynamicElement(string findByWithParameter, Focus focus) {
            FindByWithParameter = findByWithParameter;
            Focus = focus;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="parameter"></param>
        public void Click(string parameter) {
            Focus.Go();
            string findBy = String.Format(FindByWithParameter, parameter);
            Action.Click(findBy);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="parameter"></param>
        public void VerifyExists(string parameter) {
            Focus.Go();
            string findBy = String.Format(FindByWithParameter, parameter);
            Assert.IsTrue(Action.Exist(findBy));
        }

    }
}
